/**
 * @author: yasen
 * @time: 2022/10/11 11:03
 * @email: yasen@yasenstudio.com
 */
package com.showdor.springboot;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.support.Acknowledgment;

import java.sql.Connection;
import java.util.List;

public class SimpleRecordDAOProxy implements ConsumerRecordDAO {
    private ConsumerRecordDAO consumerRecordDAO;

    public SimpleRecordDAOProxy() {
        //Connection connection = new StudioMysqlConnection().getConnection();
        Connection connection = new StudioSqlServerConnection().getConnection();
        this.consumerRecordDAO = new ConsumerRecordDAOImpl(connection);
    }

    @Override
    public <K, V> void create(K key, V value, Acknowledgment ack) {
        consumerRecordDAO.create(key, value, ack);
    }

    @Override
    public <K> void create(K key, List<ConsumerRecord<String, String>> records, Acknowledgment ack) {
        consumerRecordDAO.create(key, records, ack);
    }
}
